function [] = testKS()

    %% initialization:
    iSeqLength = 10000;
    %x_i = zeros(1, iSeqLength); % create empty sequence for the pseudorandom numbers ...
	x_i = [];
    u_i = x_i; % initialize the sequence for the pseudorandom rationals ...

    % constant parameters ...
    m = 2^35; % modulus-value, 0 < m.
    a = 2^18; % multiplier, 0 < a < m.
    x_0 = 314159265; % initial start value ("seed"), 0 <= x_0 < m. 
        
    x_i(1) = x_0; % initialization of the sequence ...

    %% generate pseudorandom numbers between the interval (0, 1) with the
    %% help of the "classic" Linear Congruential Generator (LCG):
    

    %Number Of intervals
    N=10;
	
	%Interval variables
    intervals=linspace(0,1,N+1); %generate linear interval division
    values=zeros(N,iSeqLength); % matrix for storing values into intervals
	values_indexes=zeros(1,N+1);	% indexes of  interval vectors
	values_indexes(1,:)=1;
	
	
	
	%Generate random sequence
    for i = 1:iSeqLength-1
        x_i(i+1) = mod( ( (a+1)*x_i(i) + 1 ), m );
	%D_i(i) = i/iSeqLength;
	%E_i(i) = (1-i)/iSeqLength;
    end
    
	u_i=sort(u_i(2:length(u_i)));%remove seed and sort
    
    % map the generated values into pseudorandom rationals u_i in the
    % intervall (0, 1) ...
    u_i = x_i./m;
    
	F_n=zeros(iSeqLength-1);
	
	%map values to corresponding intervals
    for i=1:iSeqLength-1
		for j=1:length(intervals)
			if(u_i(i)<intervals(j))
				values(j,values_indexes(j))=u_i(i);
				values_indexes(j)=values_indexes(j)+1;
				break;
			end
		end
    end
   
	
	interval_freq=values_indexes .-1 ; %substract 1 because it was initialized with 1
	interval_freq=(values_indexes )./sum(values_indexes) ; %calculate relative frequency
			
	F_n_freq= linspace(0,1,N+1); %frequence for a linear distribution
	
	%KS table values
	Dplus= max( F_n_freq - interval_freq);
	Dminus= max(interval_freq - (F_n_freq  - 1/iSeqLength));
	D=max(Dplus,Dminus)
	
	Dalpha=0.410	% Dalpha value for N=10 alpha = 0.05
    
    
    if(D < Dalpha)
	printf "distribucion Bad"
    else
	printf "distribucion Ok"
    end
    
    
%.322	    .20
	
%.342       .15
	
%.368       .10
	
%.410       .05
	
%.490       .01
    
end
%    max=x_i(1);
%    maxi=1;
%    min=E_i(1);
%    mini=1;
    %for i=1:iSeqLength-1
	%if(x_i(i)>max)
%  	max=x_i(i);
%	maxi=i;
%	end
%	if(x_i(i)<min)
%	    min=x_i(i);
%	    maxi=i;
%	end
%	
 %   end



